home *** CD-ROM | disk | FTP | other *** search
- /* CAPITAL! The Ultimate Game of Finance.
- ST Version by: Bryan P. Schappel
- Written with: LASER C
- */
-
- #include <gemdefs.h>
- #include <stdio.h>
- #include <osbind.h>
- #include <obdefs.h>
- #include "cap.h"
- #include "monospr.c"
- #include "colrspr.c"
- #include <linea.h>
-
- #define LEFT 1
- #define RIGHT 2
- #define O_BINARY 8192
- #define NPROP 36
- #define FAST 1
- #define SLOW 2
- #define TRUE 1
- #define FALSE 0
- #define MY_DOUBLE 0
- #define NEWBUY 1
- #define NEWSEL 2
- #define NEWIMP 3
- #define DEBUG 1
- #define GOOD 1
- #define BAD 0
- #define UNOWNED -1
- #define RASTER_MODE 3
-
- int work_in[11], /* the usual GEM arrays */
- work_out[57],
- pxyarray[10],
- contrl[12],
- intin[128],
- ptsin[128],
- intout[128],
- ptsout[128],
- handle; /* workstation handle */
-
- int bfee[] = /* business fee */
- { 0, 15, 14, 8, 25, 21, 0, 12, 20,
- 22, 28, 0, 4, 6, 15, 7, 5, 0,
- 5, 8, 14, 18, 0, 7, 19, 3, 0,
- 16, 15, 21, 19, 14, 0, 31, 12, 10 };
-
- int cost[] = /* initial cost */
- { 0, 23, 37, 25, 69, 65, 0, 41, 60,
- 73, 84, 0, 12, 15, 38, 17, 13, 0,
- 18, 27, 36, 37, 0, 22, 51, 11, 0,
- 53, 48, 56, 61, 32, 0, 100, 47, 42 };
-
- int reftab[] = /* refresh table */
- {128, 0, 0, 0, 2, 2, 4, 0, 0,
- 2, 2, 128, 0, 0, 0, 2, 2, 128,
- 0, 2, 2, 0, 4, 0, 0, 0, 128,
- 2, 2, 0, 2, 2, 128, 0, 2, 2 };
-
- int xref[] = /* cross reference table */
- { 0, 0, 0, 0, 5, 4, 0, 0, 0,
- 10, 9, 0, 0, 0, 0, 16, 15, 0,
- 0, 20, 19, 0, 0, 0, 0, 0, 0,
- 28, 27, 0, 31, 30, 0, 0, 35, 34 };
-
- char *prop_names[] = /* property names */
- { "Stock Market Dividends pay 12G", "Wilt's Vegetables",
- "Titanic Shipping", "Rex Auto Corporation",
- "Schappel's Scalpels", "Stytch's Clinic",
- "The Luck Square", "Crosstrax Railway",
- "Black Gold Oil", "HAL Computers",
- "Silicon Gulch", "Vacation time at the Hogg Hilton",
- "Black Jack's Casino", "Death Valley Spa",
- "Selmart Stores", "Adams Apple Orchard",
- "Sour Grapes Vineyard", "IRS Audit: lose 12% of your cash",
- "Drip Dry Cleaners", "Spud's Potato Farm",
- "Bar-B-Q Ranch", "Jetstream Airlines",
- "The Luck Square", "Ringading Telephone",
- "IOU Penneys", "Thredbare Clothing",
- "Vacation time at the Hogg Hilton", "Kolbe's Cheese",
- "Daisy's Dairy", "Steal Steelworks",
- "Cross Eye Cable TV", "Olde Yorke Times",
- "Capital Gains Tax", "Disastrous Insurance",
- "Heavy Water Company", "Short Circuit Power & Light" };
-
- char *spaces = " ";
-
- char *new_buttons[] = /* button text */
- { "DOUBLE", "NEXT",
- "BACK", "SELECT" };
-
- char *player_names[] = /* player name array */
- { "Player 1", "Player 2",
- "Player 3", "Player 4",
- "None" };
-
- long *icon_addr[9], /* icon addresses */
- *dice[6]; /* dice icon addresses */
- int *sprites[4]; /* sprite definition adresses */
-
- char *options[] = /* transaction option headings */
- { " ", "Buy",
- "Double", "Sell",
- "Improve", "Forced Sale" };
-
- spriteback spr1,spr2,spr3,spr4;
-
- long usamap,backup; /* pointer to screen */
- long scr_buf[8000];
-
- lineaport *myport; /* line a port variable */
-
- int who[NPROP], /* property owners */
- imp[NPROP], /* property improvement levels */
- rantab[NPROP], /* random property value table */
- refresh[NPROP], /* refresh table */
- gcost[NPROP], /* cost of props in game */
- gfee[NPROP], /* prop fees in game */
- cash[4], /* players cash */
- on_board[4], /* players on board */
- player, /* player that is up */
- num_players, /* number of players that start */
- num_left, /* number of players left */
- rez, /* screen resolution */
- offset = 1, /* resolution conversion factor */
- game_speed, /* speed of game SLOW/FAST */
- board_pos[4], /* board positions of players */
- nplanes = 4, /* number of bit planes in screen */
- desk_pal[16], /* desktop palette */
- dum; /* dummy */
-
- extern mouse_rts();
-
- unsigned char crash[] = { 0x06,0x1f,0x07,0x2f,0x09,0x10,
- 0x0c,0x20,0x0d,0x00,0x81,0x12,
- 0x02,0xf8,0xff,0x00 };
-
-
- /*********************************************************************
- * get_tedinfo()
- *
- * This function returns a pointer to a character array in a
- * TEDINFO structure. This is used so may of the other functions
- * in this program can change the information in the numerous
- * dialogs.
- **********************************************************************/
-
- char *get_tedinfo (atree, object)
- OBJECT *atree;
- int object;
- {
- TEDINFO *ob_tedinfo;
-
- ob_tedinfo = (TEDINFO *) atree[object].ob_spec;
- return ( ob_tedinfo->te_ptext );
- }
-
-
- /*********************************************************************
- * main()
- *
- * This is the MAIN routine. Here we initialize the program and
- * run the program from a loop until you decide to quit the game.
- **********************************************************************/
-
- main()
- {
- int current_prop, /* current property */
- dx,dy,dw,dh,
- i,num,choice;
- OBJECT *tree;
-
- appl_init();
- graf_mouse(M_OFF,0L);
- for (i = 0; i < 16; desk_pal[i++] = Setcolor(i,-1));
- open_vwork();
- v_clrwk(handle);
- graf_mouse(M_ON,0L);
- graf_mouse(ARROW,0L);
- myport = a_init();
- rez = Getrez();
-
- if ( ! rsrc_load("\CAP.RSC") )
- form_alert(1,"[3][ |CAP.RSC File Missing!|Fatal Error.][ OOPS! ]");
- else
- if (rez == 1)
- form_alert(1,"[3][ |CAPITAL! Only runs|in Low or High|Resolution][ OOPS! ]");
- else {
- usamap = (Malloc(32768L) & 0xffffff00) + 0x100;
- backup = (Malloc(32768L) & 0xffffff00) + 0x100;
-
- if (rez == 2) {
- offset = 2;
- nplanes = 1;
- }
- load_map_screen();
- do_intro();
-
- do {
- init_vars();
- get_names();
- player = 3;
-
- do {
- current_prop = map_move();
- if (current_prop > 0) perform_trans(current_prop);
- } while (num_left > 1 && current_prop > 0);
-
- if (num_left == 1) {
- rsrc_gaddr(0,WINDIAL,&tree);
- for (i = 0; i < 4; i++) if (on_board[i]) num = i;
- sprintf(get_tedinfo(tree,WIN_NAME),"%s Wins!",player_names[num]);
- draw_dialog(tree,&dx,&dy,&dw,&dh,TRUE);
- choice = form_do(tree,0);
- close_dialog(dx,dy,dw,dh,TRUE);
- }
- rsrc_gaddr(0,QUITGAME,&tree);
- draw_dialog(tree,&dx,&dy,&dw,&dh,TRUE);
- choice = form_do(tree,0);
- close_dialog(dx,dy,dw,dh,TRUE);
- } while (choice != DESK_TOP);
-
- rsrc_free();
- Mfree(usamap);
- Mfree(backup);
- }
- graf_mouse(M_OFF,0L);
- v_clrwk(handle);
- graf_mouse(M_ON,0L);
- graf_mouse(ARROW,0L);
- v_clsvwk(handle);
- Setpalette(desk_pal);
- appl_exit();
- }
-
-
- /*********************************************************************
- * map_move()
- *
- * Here is where we move the player pieces around the MAP screen.
- * The amount to move is determined by the Roll_dice() routine.
- * After the dice have been thrown, the player piece is moved over
- * each square. Certain transactions are handled here, such as
- * the Stock Market and Tax squares.
- **********************************************************************/
-
- int map_move()
- {
- int roll,i,j,flag,bp;
-
- flag = FALSE;
- do {
- do {
- ++player;
- if (player > 3) player = 0;
- flag = on_board[player];
- } while (flag == FALSE);
-
- draw_screen();
- if (board_pos[player] == NPROP) board_pos[player] = 0;
- roll = roll_dice();
- bp = roll;
- if (roll > 0) {
- for (i = 0; i < roll; i++) {
- ++board_pos[player];
- if (board_pos[player] == NPROP) board_pos[player] = 0;
- sprite_move(player,board_pos[player]);
- print_prop(board_pos[player]);
- if (board_pos[player] == 0) {
- cash[player] += 12;
- form_dollar(TRUE);
- wait_jiffy(80);
- }
- wait_jiffy(20);
- }
- bp = board_pos[player];
- if (bp == 17) {
- cash[player] -= cash[player] / 8;
- if (cash[player] <1) cash[player] = 1; /* tax break for the poor */
- form_dollar(TRUE);
- }
- if (bp == 17 || bp == 11 || bp == 26) wait_jiffy(80);
- }
- } while (bp == 17 || bp == 0 || bp == 11 || bp == 26);
- return(bp);
- }
-
-
- /*********************************************************************
- * open_vwork()
- *
- * Open the Virtual Workstation.
- **********************************************************************/
-
- open_vwork()
- {
- int i;
-
- handle=graf_handle(&dum,&dum,&dum,&dum);
- for (i=0; i<10; work_in[i++]=1);
- work_in[10]=2;
- v_opnvwk(work_in,&handle,work_out);
- }
-
-
- /*********************************************************************
- * init_vars()
- *
- * This routine initializes ALL of the game arrays and other
- * variables.
- **********************************************************************/
-
- init_vars()
- {
- int i; /* dummy index */
-
- for (i = 0; i < NPROP; i++) {
- who[i] = UNOWNED;
- imp[i] = 0;
- refresh[i] = reftab[i];
- gcost[i] = cost[i];
- gfee[i] = bfee[i];
- }
-
- for (i = 0; i < 4; i++) {
- cash[i] = 375;
- on_board[i] = FALSE;
- board_pos[i] = NPROP;
- }
-
- if (offset == 2) {
- icon_addr[0] = sngl_ok;
- icon_addr[1] = sngl_sold;
- icon_addr[2] = dbl_ok;
- icon_addr[3] = dbl_sold;
- icon_addr[4] = luck_icon;
- icon_addr[5] = hogg_icon;
- icon_addr[6] = doll_icon;
- icon_addr[7] = tax_icon;
- icon_addr[8] = cgains;
- sprites[0] = mspr1;
- sprites[1] = mspr2;
- sprites[2] = mspr3;
- sprites[3] = mspr4;
- dice[0] = die1m;
- dice[1] = die2m;
- dice[2] = die3m;
- dice[3] = die4m;
- dice[4] = die5m;
- dice[5] = die6m;
- }
- else {
- icon_addr[0] = csngok;
- icon_addr[1] = csngsold;
- icon_addr[2] = cdblok;
- icon_addr[3] = cdblsold;
- icon_addr[4] = cluck;
- icon_addr[5] = chogg;
- icon_addr[6] = cdoll;
- icon_addr[7] = ctax;
- icon_addr[8] = ccgain;
- sprites[0] = cspr1;
- sprites[1] = cspr2;
- sprites[2] = cspr3;
- sprites[3] = cspr4;
- dice[0] = cdie1;
- dice[1] = cdie2;
- dice[2] = cdie3;
- dice[3] = cdie4;
- dice[4] = cdie5;
- dice[5] = cdie6;
- }
- }
-
-
- /*********************************************************************
- * set_buttons()
- *
- * This displays the OPTION buttons on the transaction dialog. It
- * updates the selectability of the buttons indicating what options
- * are left to the player.
- **********************************************************************/
-
- set_buttons(tree,buy,sell,improve)
- OBJECT *tree;
- int buy,sell,improve;
-
- {
- int x,y; /* for dialog redraw */
-
- if (buy) tree[BUYBUTN].ob_state = NORMAL;
- else tree[BUYBUTN].ob_state = DISABLED;
-
- if (sell) tree[SELBUTN].ob_state = NORMAL;
- else tree[SELBUTN].ob_state = DISABLED;
-
- if (improve) tree[IMPBUTN].ob_state = NORMAL;
- else tree[IMPBUTN].ob_state = DISABLED;
-
- objc_offset(tree,BUTNFLD,&x,&y);
- objc_draw(tree,BUTNFLD,1,x,y,300,190);
- draw_opt(tree);
- form_dollar(FALSE);
- }
-
-
- /********************************************************************
- * draw_opt()
- *
- * This routine just draws the TRNOPTS field for the transaction
- * processor.
- **********************************************************************/
-
- draw_opt(tree)
- OBJECT *tree;
- {
- int x,y;
-
- objc_offset(tree,TRNBOX,&x,&y);
- objc_draw(tree,TRNBOX,1,x,y,96,16);
- }
-
-
- /*********************************************************************
- * perform_trans()
- *
- * This is the heart of the program - the transaction processor.
- * This routine plays the BANKER for the game. All properties are
- * bought/sold/improved through this code.
- **********************************************************************/
-
- perform_trans(cprop)
- int cprop;
- {
- OBJECT *tree_addr; /* Object tree address */
- char *oldptr,*optptr;
- int disaster = FALSE, /* disaster flag */
- tprop,
- tcost,
- choice, /* button choice */
- dx,dy,dw,dh, /* dialog box coords. */
- x,y, /* dialog portion coords. */
- buy_flag = FALSE, /* property buy flag */
- sell_flag, /* property sell flag */
- imp_flag, /* property improve flag */
- opt_ok = FALSE, /* option allow flag */
- d_flag = FALSE; /* dialog display flag */
-
- make_ran(disaster);
- if (refresh[cprop] == 4) do_luck(&disaster);
- else if (who[cprop] == UNOWNED && refresh[cprop] != 128) buy_flag = TRUE;
-
- sell_flag = haveany();
- imp_flag = sell_flag;
- opt_ok = !sell_flag;
-
- if ((who[cprop] != UNOWNED) && (who[cprop] != player)) pay_fee(&disaster,cprop);
- if (cprop == 32) capital_gains(&disaster);
-
- if (buy_flag || sell_flag || imp_flag || disaster) {
- rsrc_gaddr(0,TRANSACT,&tree_addr);
- optptr = get_tedinfo(tree_addr,TRNOPTS);
- sprintf(optptr,"%s",options[0]);
- insert_prop(tree_addr,cprop);
- sprintf(get_tedinfo(tree_addr,TRANPLR),"For: %s",player_names[player]);
-
- if ((disaster == TRUE) && (game_speed == SLOW)) {
- draw_dialog(tree_addr,&dx,&dy,&dw,&dh,FALSE);
- set_buttons(tree_addr,buy_flag,sell_flag,imp_flag);
- force_sale(&disaster,tree_addr);
- d_flag = TRUE;
- }
-
- if (!disaster) {
- if (!d_flag) {
- draw_dialog(tree_addr,&dx,&dy,&dw,&dh,FALSE);
- set_buttons(tree_addr,buy_flag,sell_flag,imp_flag);
- d_flag = TRUE;
- }
- do {
- choice = form_do(tree_addr,0);
- if (choice == BUYBUTN && buy_flag == TRUE) {
- sprintf(optptr,"%s",options[1]);
- draw_opt(tree_addr);
- buy_it(tree_addr,cprop);
- if (who[cprop] != UNOWNED && xref[cprop] != 0) {
- tprop = cprop;
- cprop = xref[tprop];
- tcost = gcost[cprop];
- gcost[cprop] *= 2;
- oldptr = (char *)tree_addr[BUYBUTN].ob_spec;
- (char *)tree_addr[BUYBUTN].ob_spec = new_buttons[MY_DOUBLE];
- sprintf(optptr,"%s",options[2]);
- set_buttons(tree_addr,TRUE,FALSE,FALSE);
- show_prop(tree_addr,cprop);
- do {
- choice = form_do(tree_addr,0);
- if (choice == BUYBUTN) {
- buy_it(tree_addr,cprop);
- choice = TEXIT;
- }
- } while (choice != TEXIT);
- (char *)tree_addr[BUYBUTN].ob_spec = oldptr;
- gcost[cprop] = tcost;
- cprop = tprop;
- show_prop(tree_addr,cprop);
- }
- buy_flag = FALSE;
- if (opt_ok) {
- imp_flag = haveany();
- sell_flag = imp_flag;
- }
- choice = BUYBUTN;
- }
- if (choice == IMPBUTN && imp_flag == TRUE) {
- sprintf(optptr,"%s",options[4]);
- draw_opt(tree_addr);
- imp_it(tree_addr);
- imp_flag = FALSE;
- }
- if (choice == SELBUTN && sell_flag == TRUE) {
- sprintf(optptr,"%s",options[3]);
- set_buttons(tree_addr,buy_flag,sell_flag,imp_flag);
- sell_it(tree_addr,disaster);
- sell_flag = FALSE;
- }
- if ((buy_flag == FALSE) && (sell_flag == FALSE) && (imp_flag == FALSE)) choice = TEXIT;
- sprintf(optptr,"%s",options[0]);
- set_buttons(tree_addr,buy_flag,sell_flag,imp_flag);
- } while (choice != TEXIT);
- close_dialog(dx,dy,dw,dh,FALSE);
- }
- else { /* disaster is TRUE */
- if (d_flag) close_dialog(dx,dy,dw,dh,FALSE);
- cash[player] = 0;
- form_dollar(FALSE);
- rsrc_gaddr(0,DEADIAL,&tree_addr);
- sprintf(get_tedinfo(tree_addr,BRNAME),"%s",player_names[player]);
- draw_dialog(tree_addr,&dx,&dy,&dw,&dh,TRUE);
- form_do(tree_addr,0);
- close_dialog(dx,dy,dw,dh,TRUE);
-
- on_board[player] = FALSE;
- --num_left;
- cprop = 0;
- for (cprop = 0; cprop < NPROP; cprop++)
- if (who[cprop] == player) {
- who[cprop] = UNOWNED;
- --refresh[cprop];
- if (gcost[cprop] > 1) gcost[cprop] /= 2;
- }
- }
- }
- }
-
-
- /*********************************************************************
- * buy_it()
- *
- * This routine is responsible for selling a property to a player.
- * If the player has enough cash, the sale is allowed otherwise
- * the sale is aborted.
- **********************************************************************/
-
- buy_it(tree,property)
- OBJECT *tree;
- int property;
- {
- if (cash[player] > gcost[property]) {
- cash[player] -= gcost[property];
- ++refresh[property];
- who[property] = player;
- show_prop(tree,property);
- trans_ok();
- }
- else no_cash();
- }
-
-
- /*********************************************************************
- * imp_it()
- *
- * This routine allows a player to improve one of his properties.
- * If the player has enough cash, the player selects the property
- * and the improvement is made.
- **********************************************************************/
-
- imp_it(tree)
- OBJECT *tree;
- {
- int property;
-
- if (haveany() == TRUE) {
- if (cash[player] < 11) no_cash();
- else {
- property = pick_prop(tree,FALSE);
- if (property > UNOWNED) if (imp[property] < 3) {
- ++imp[property];
- gfee[property] *= 2;
- gcost[property] += 5;
- cash[player] -= 10;
- show_prop(tree,property);
- trans_ok();
- }
- }
- }
- }
-
-
- /*********************************************************************
- * sell_it()
- *
- * This routine lets players sell properties. The player makes the
- * choice of which property goes and it is put up for sale again.
- **********************************************************************/
-
- sell_it(tree,disaster)
- OBJECT *tree;
- int disaster;
- {
- int property; /* property to sell */
-
- if (haveany() == TRUE) {
- property = pick_prop(tree,disaster);
- if (property != UNOWNED) {
- who[property] = UNOWNED;
- cash[player] += rantab[property];
- --refresh[property];
- show_prop(tree,property);
- trans_ok();
- }
- }
- }
-
-
- /*********************************************************************
- * haveany()
- *
- * This function scans the property owner list for any properties
- * that the current player may own. If a match is found then the
- * player owns some properties and we can return a TRUE otherwise
- * we return a FALSE.
- **********************************************************************/
-
- int haveany()
- {
- int i, flag = FALSE; /* loop variable & flag */
-
- for (i = 0; i < NPROP; i++) if (who[i] == player) flag = TRUE;
- return(flag);
- }
-
-
- /*********************************************************************
- * pick_prop()
- *
- * This function allows the current player to scan through their
- * properties and select one to sell or improve. This function
- * makes some changes to the BUTNFLD buttons in the TRANSACT
- * dialog. If the disaster flag is set the player MUST choose
- * a property, he can't press the EXIT button.
- **********************************************************************/
-
- pick_prop(tree,disaster)
- OBJECT *tree;
- int disaster;
-
- {
- int property, /* current property number */
- choice, /* button choice */
- select_flg = FALSE, /* select flag */
- props[NPROP], /* owned property array */
- num_owned = 0, /* number of props owned */
- num = 0, /* number of current property */
- i, /* junk loop variable */
- add; /* property addition factor */
- char *oldbuy,*oldsel,*oldimp; /* hold variables */
-
- if (haveany()) {
- for (i = 0; i < NPROP; i++)
- if (who[i] == player) {
- props[num_owned] = i;
- ++num_owned;
- }
-
- oldbuy = (char *)tree[BUYBUTN].ob_spec;
- (char *)tree[BUYBUTN].ob_spec = new_buttons[NEWBUY];
- oldsel = (char *)tree[SELBUTN].ob_spec;
- (char *)tree[SELBUTN].ob_spec = new_buttons[NEWSEL];
- oldimp = (char *)tree[IMPBUTN].ob_spec;
- (char *)tree[IMPBUTN].ob_spec = new_buttons[NEWIMP];
-
- if (disaster) {
- tree[TEXIT].ob_state = DISABLED;
- sprintf(get_tedinfo(tree,TRNOPTS),"%s",options[5]);
- set_buttons(tree,TRUE,TRUE,TRUE);
- }
- else {
- tree[TEXIT].ob_state = NORMAL;
- set_buttons(tree,TRUE,TRUE,TRUE);
- }
-
- do {
- property = props[num];
- add = 1;
- select_flg = FALSE;
- show_prop(tree,property);
- add = 10;
- do {
- choice = form_do(tree,0);
- if (choice == BUYBUTN) add = 1;
- if (choice == SELBUTN) add = -1;
- if (choice == IMPBUTN) {
- select_flg = TRUE;
- add = 0;
- }
- if (choice == TEXIT && disaster == FALSE) {
- property = UNOWNED;
- add = 0;
- select_flg = TRUE;
- }
- } while (add == 10);
- num += add;
- if (select_flg == FALSE) {
- if (num < 0) num = num_owned - 1;
- if (num == num_owned) num = 0;
- }
- } while (select_flg == FALSE);
- (char *)tree[BUYBUTN].ob_spec = oldbuy;
- (char *)tree[SELBUTN].ob_spec = oldsel;
- (char *)tree[IMPBUTN].ob_spec = oldimp;
- tree[TEXIT].ob_state = NORMAL;
- set_buttons(tree,TRUE,TRUE,TRUE);
- }
- return(property);
- }
-
-
- /*********************************************************************
- * trans_ok()
- *
- * This routine displays a small alert box informing the player that
- * the last selected transaction has been processed successfully.
- **********************************************************************/
-
- trans_ok()
- {
- form_dollar(FALSE);
- form_alert(1,"[0][ |Transaction Processed ][ OK ]");
- }
-
-
- /*********************************************************************
- * no_cash()
- *
- * This routine just displays a small alert box informing the player
- * that they don't have enough cash on hand for the purchase.
- **********************************************************************/
-
- no_cash()
- {
- form_dollar(FALSE);
- form_alert(1,"[0][ |Insufficient Funds ][ OK ]");
- }
-
-
- /*********************************************************************
- * get_fee()
- *
- * This function returns the fee for the property that the player
- * has just landed on. If the property is part of a double and both
- * halves of the double are owned by the same player, the fee is the
- * sum of the two properties.
- **********************************************************************/
-
- int get_fee(prop)
- int prop;
- {
- int the_fee;
-
- the_fee = gfee[prop];
- if (xref[prop] != 0 && who[prop] != UNOWNED)
- if (who[prop] == who[xref[prop]]) the_fee += gfee[xref[prop]];
- return(the_fee);
- }
-
-
- /*********************************************************************
- * insert_prop()
- *
- * This routine puts the property information into the TRANSACT
- * dialog's TEDINFO structures.
- **********************************************************************/
-
- insert_prop(tree,prop)
- OBJECT *tree;
- int prop;
- {
- char *string; /* temp string pointer */
- int p_owner; /* owner number */
-
- sprintf(get_tedinfo(tree,PROPERTY), "Prop: %s", prop_names[prop]);
- sprintf(get_tedinfo(tree,RESALE), "Resale: %dG", rantab[prop]);
- sprintf(get_tedinfo(tree,PRICE), "Price: %dG", gcost[prop]);
- sprintf(get_tedinfo(tree,LEVEL), "Level: %d", imp[prop]);
-
- string = get_tedinfo(tree,DOUBLE);
- if (xref[prop] == 0) sprintf(string, "Double: No");
- else sprintf(string, "Double: Yes");
-
- sprintf(get_tedinfo(tree,FEE), "Fee: %dG", get_fee(prop));
-
- p_owner = who[prop];
- if (p_owner == UNOWNED) p_owner = 4;
- string = get_tedinfo(tree,OWNER);
- sprintf(string, "Owner: %s",player_names[p_owner]);
- }
-
-
- /*********************************************************************
- * show_prop()
- *
- * This routine shows the information for the current property.
- * It just redraws a section of the TRANSACT dialog to accomplish
- * this little feat.
- **********************************************************************/
-
- show_prop(tree,prop)
- OBJECT *tree;
- int prop; /* property number */
-
- {
- int prop_x,prop_y; /* property area x, y */
-
- insert_prop(tree,prop); /* put in property info */
- objc_offset(tree, PROPFLD, &prop_x, &prop_y);
- objc_draw(tree, PROPFLD, 2, prop_x, prop_y, 320, 80);
- }
-
-
- /*********************************************************************
- * get_names()
- *
- * This routine is responsible for getting the parameters for the
- * upcoming game. Such as: # of players, speed of game and the
- * names of the players.
- **********************************************************************/
-
- get_names()
- {
- OBJECT *tree;
- int x,y; /* x, y of input box */
- int dx,dy,dw,dh; /* dialog x,y,w,h */
- int choice; /* button choice */
- int i; /* loop variable */
-
- rsrc_gaddr(0,NAMEDIAL,&tree);
-
- tree[FASTBUTN].ob_state = SELECTED;
- tree[SLOWBUTN].ob_state = NORMAL;
- tree[PBUT2].ob_state = SELECTED | SHADOWED;
- tree[PBUT3].ob_state = SHADOWED;
- tree[PBUT4].ob_state = SHADOWED;
-
- num_players = 2;
- game_speed = FAST;
-
- draw_dialog(tree,&dx,&dy,&dw,&dh,TRUE);
- draw_name_area(tree);
- draw_em(tree,SELECTED,NORMAL);
- graf_mouse(ARROW,0L);
-
- do {
- choice = form_do(tree,PEDIT1);
- if (choice == PBUT2) {
- num_players = 2;
- draw_name_area(tree);
- }
- if (choice == PBUT3) {
- num_players = 3;
- draw_name_area(tree);
- }
- if (choice == PBUT4) {
- num_players = 4;
- draw_name_area(tree);
- }
- if (choice == FASTBUTN) {
- game_speed = FAST;
- draw_em(tree,SELECTED,NORMAL);
- }
- if (choice == SLOWBUTN) {
- game_speed = SLOW;
- draw_em(tree,NORMAL,SELECTED);
- }
- }
- while (choice != DONEBUTN);
- close_dialog(dx,dy,dw,dh,TRUE);
- }
-
-
- /*********************************************************************
- * draw_name_area()
- *
- * This routine draws the PLAYER NAME area of the get_names()
- * screen.
- **********************************************************************/
-
- draw_name_area(tree)
- OBJECT *tree;
- {
- int dx,dy,x;
- for (x = PEDIT1; x < PEDIT4 + 1; x++) {
- tree[x].ob_state = NORMAL;
- tree[x].ob_flags = HIDETREE;
- on_board[x - PEDIT1] = FALSE;
- }
-
- tree[DONEBUTN].ob_state = NORMAL;
- objc_offset(tree,DONEBUTN,&dx,&dy);
- objc_draw(tree,DONEBUTN,1,dx,dy,75,24);
-
- for (x = 0; x < num_players; x++) {
- tree[PEDIT1 + x].ob_flags = EDITABLE;
- on_board[x] = TRUE;
- }
-
- objc_offset(tree,PLR_NAME,&dx,&dy);
- objc_draw(tree,PLR_NAME,2,dx,dy,170,200);
- num_left = num_players;
- for (x = 0; x < 4; x++) player_names[x] = get_tedinfo(tree,PEDIT1+x);
- }
-
-
- /*********************************************************************
- * draw_em()
- *
- * This routine just draws the game speed buttons on the NAMEDIAL
- * screen.
- **********************************************************************/
-
- draw_em(tree,flag1,flag2)
- OBJECT *tree;
- int flag1,flag2;
- {
- int x,y;
-
- tree[FASTBUTN].ob_state = flag1;
- tree[SLOWBUTN].ob_state = flag2;
- objc_offset(tree,FASTBUTN,&x,&y);
- objc_draw(tree,FASTBUTN,2,x,y,32,16);
- objc_offset(tree,SLOWBUTN,&x,&y);
- objc_draw(tree,SLOWBUTN,2,x,y,32,16);
- }
-
-
- /*********************************************************************
- * do_luck()
- *
- * This is the LUCK routine. This routine is called when a player
- * lands on a luck square. First we determine whether the player
- * has good luck or bad, then we pick one of three 'goodies' and
- * give it to the player. The LUCKDIAL dialog is used to tell
- * the player what they won/lost.
- **********************************************************************/
-
- do_luck(disaster)
- int *disaster;
- {
- int luck,
- luck_num;
- char *string,*string2;
- OBJECT *tree;
- int dx,dy,dw,dh,property,choice;
-
- rsrc_gaddr(0,LUCKDIAL,&tree);
- luck = Random() & 0x01;
- string = get_tedinfo(tree,LUCK1);
- if (luck == GOOD) sprintf(string,"Your luck was: Good");
- else sprintf(string,"Your luck was: Bad");
-
- sprintf(get_tedinfo(tree,LUCKNAME),"%s",player_names[player]);
- string = get_tedinfo(tree,LUCK2);
- string2 = get_tedinfo(tree,LUCK3);
-
- luck_num = rnd(3);
-
- if ((luck == BAD) && (haveany() == FALSE)) luck_num = 0;
- if ((luck == GOOD) && (haveany() == FALSE) && (luck_num == 2)) luck_num = 0;
-
- if (luck == GOOD)
- switch (luck_num) {
- case 0:
- cash[player] += 10;
- sprintf(string,"You win:");
- sprintf(string2,"10G");
- break;
- case 1:
- cash[player] += 15;
- sprintf(string,"You win:");
- sprintf(string2,"15G");
- break;
- case 2:
- property = get_random_prop();
- if (imp[property] == 3) {
- cash[player] += 10;
- sprintf(string,"You win:");
- sprintf(string2,"10G");
- }
- else {
- ++imp[property];
- gfee[property] *= 2;
- gcost[property] += 5;
- sprintf(string,"You win improvement on:");
- sprintf(string2,"%s",prop_names[property]);
- }
- break;
- }
- else
- switch (luck_num) {
- case 0:
- cash[player] -= 10;
- sprintf(string,"You lose:");
- sprintf(string2,"10G");
- break;
- case 1:
- property = get_random_prop();
- if (gfee[property] < 1) {
- cash[player] -= 10;
- sprintf(string,"You lose:");
- sprintf(string2,"10G");
- }
- else {
- gfee[property] /= 2;
- sprintf(string,"You lose 1/2 fee on:");
- sprintf(string2,"%s",prop_names[property]);
- }
- case 2:
- property = get_random_prop();
- if (gcost[property] < 2) {
- cash[player] -= 10;
- sprintf(string,"You lose:");
- sprintf(string2,"10G");
- }
- else {
- gcost[property] /= 2;
- sprintf(string,"You lose 1/2 value on:");
- sprintf(string2,"%s",prop_names[property]);
- }
- }
- if (cash[player] < 1) *disaster = TRUE;
- form_dollar(FALSE);
- draw_dialog(tree,&dx,&dy,&dw,&dh,TRUE);
- form_do(tree,0);
- close_dialog(dx,dy,dw,dh,TRUE);
- }
-
-
- /*********************************************************************
- * make_ran()
- *
- * This routine creates the RANDOM value property table. This
- * table depends on whether or not the DISASTER flag is set. The
- * values range from 1/2 to full price (if DISASTER is FALSE) or
- * just 1/2 price (if DISASTER is TRUE).
- **********************************************************************/
-
- make_ran(disaster)
- int disaster;
- {
- int my_ran,
- property = 0;
-
- do {
- rantab[property] = gcost[property];
- if ((who[property] == player) && (gcost[property] > 1)) {
- rantab[property] /= 2;
- if ( !disaster ) rantab[property] += rnd(rantab[property]);
- }
- ++property;
- } while(property < NPROP);
- }
-
-
- /*********************************************************************
- * rnd()
- *
- * This function returns a random number between 0 & n-1.
- **********************************************************************/
-
- int rnd( n )
- int n;
- {
- int r;
-
- r = (int)Random();
- return(abs(r) % n);
- }
-
-
- /*********************************************************************
- * get_random_prop()
- *
- * This routine gets a random property number that is owned by
- * the current player for the luck routine.
- **********************************************************************/
-
- int get_random_prop()
- {
- int prop_array[NPROP],
- index = 0,
- current = 0;
-
- do {
- if (who[current] == player) {
- prop_array[index] = current;
- ++index;
- }
- ++current;
- } while (current < NPROP);
-
- current = rnd(index);
-
- return(prop_array[current]);
- }
-
-
- /*********************************************************************
- * pay_fee()
- *
- * This routine exacts the fee from the hide of the current player.
- * If the player does not have the money, the disaster flag is set.
- **********************************************************************/
-
- pay_fee(disaster,property)
- int *disaster,property;
- {
- int dx,dy,dw,dh,choice,the_fee;
- OBJECT *tree;
- char *string;
-
- the_fee = get_fee(property);
- cash[player] -= the_fee;
- if (cash[player] < 1) *disaster = TRUE;
- rsrc_gaddr(0,FEE_DIAL,&tree);
-
- sprintf(get_tedinfo(tree,FEE_1),player_names[player]);
- sprintf(get_tedinfo(tree,FEE_3),player_names[who[property]]);
- sprintf(get_tedinfo(tree,FEE_2),"pays %dG to",the_fee);
-
- cash[who[property]] += the_fee;
- draw_dialog(tree,&dx,&dy,&dw,&dh,TRUE);
- form_do(tree,0);
- close_dialog(dx,dy,dw,dh,TRUE);
- }
-
-
- /*********************************************************************
- * capital_gains()
- *
- * This routine is for the CAPITAL GAINS TAX square. If the player
- * lands here, they lose 45G!
- **********************************************************************/
-
- capital_gains(disaster)
- int *disaster;
- {
- int choice,dx,dy,dw,dh;
- OBJECT *tree;
-
- rsrc_gaddr(0,CAPGAINS,&tree);
- sprintf(get_tedinfo(tree,CG_NAME),"%s",player_names[player]);
- draw_dialog(tree,&dx,&dy,&dw,&dh,TRUE);
- form_do(tree,0);
- close_dialog(dx,dy,dw,dh,TRUE);
- cash[player] -= 45;
- form_dollar(FALSE);
- if (cash[player] < 1) *disaster = TRUE;
- }
-
-
- /*********************************************************************
- * force_sale()
- *
- * This routine forces a player to sell off his/her properties in
- * case of a disaster. This is done so that other players get their
- * fee. If the player sells enough properties to pay the debt
- * the disaster flag is set to FALSE, otherwise the player is
- * BROKE and is out of the game.
- **********************************************************************/
-
- force_sale(disaster,tree)
- int *disaster;
- OBJECT *tree;
- {
- int i,
- property,
- value = 0;
-
- if ((haveany() == TRUE) && (game_speed == SLOW)) {
- for (i = 0; i < NPROP; i++) if (who[i] == player) value += rantab[i];
- if (cash[player] + value > 0) {
- make_ran(TRUE);
- do {
- property = pick_prop(tree,TRUE);
- who[property] = UNOWNED;
- cash[player] += rantab[property];
- form_dollar(FALSE);
- --refresh[property];
- } while (cash[player] < 1);
- *disaster = FALSE;
- make_ran(FALSE);
- }
- }
- }
-
-
- /*********************************************************************
- * draw_icon()
- *
- * This routine is used to draw the dice and properties on the
- * screen. The routine was taken from the Moon Lord source.
- **********************************************************************/
-
- draw_icon( data, mode, dx, dy, width, height)
- long data;
- int mode,dx,dy,width,height;
- {
- MFDB s_m,scr_m;
- int pxy[8];
-
- s_m.fd_addr = data;
- s_m.fd_w = width;
- s_m.fd_h = height;
- s_m.fd_wdwidth = width / 16;
- s_m.fd_stand= 0;
- s_m.fd_nplanes = nplanes;
- scr_m.fd_addr = 0;
- pxy[0] = 0;
- pxy[1] = 0;
- pxy[2] = width;
- pxy[3] = height;
- pxy[4] = dx;
- pxy[5] = dy;
- pxy[6] = dx + width;
- pxy[7] = dy + height;
- vro_cpyfm(handle,mode,pxy,&s_m,&scr_m);
- }
-
-
- /*********************************************************************
- * draw_screen()
- *
- * This function draws all the icons on the screen for the MAP
- * handler. The addresses of the icons to draw are stored in the
- * icon_addr array.
- **********************************************************************/
-
- draw_screen()
- {
- int index,icon_num;
- long phys_scr,log_scr;
-
- graf_mouse(M_OFF,0L);
- phys_scr = Physbase();
- log_scr = Logbase();
- scr_copy(phys_scr,backup);
- Setscreen(log_scr,backup,-1);
- Vsync();
- scr_copy(usamap,phys_scr);
- for (index = 0; index < NPROP; index++) {
- icon_num = refresh[index];
- if (index == 0) icon_num = 6; /* stock market */
- if (index == 32) icon_num = 8; /* capital gains */
- if (index == 11 || index == 26) icon_num = 5; /* hogg hilton */
- if (index == 6 || index == 22) icon_num = 4; /* luck */
- if (index == 17) icon_num = 7; /* tax man */
- if (offset == 2) draw_icon(icon_addr[icon_num],RASTER_MODE,icon_x[index]*offset,icon_y[index]*offset,MONO_ICON_W,MONO_ICON_H);
- else draw_icon(icon_addr[icon_num],RASTER_MODE,icon_x[index],icon_y[index],C_ICON_W,C_ICON_H);
- }
- show_sprites();
- Setscreen(log_scr,phys_scr,-1);
- Vsync();
- form_dollar(TRUE);
- graf_mouse(M_ON,0L);
- }
-
-
- /*********************************************************************
- * load_map_screen()
- *
- * This routine loads in the DEGAS MAP screen and sets the color
- * palette for the game.
- **********************************************************************/
-
- load_map_screen()
- {
- int palette[16], buf[20];
- int fh;
-
- if (offset == 2) fh = open("\USAMAPHI.PI3", O_BINARY);
- if (offset == 1) fh = open("\USAMAPLO.PI1", O_BINARY);
- read(fh,buf,2);
- read(fh,palette,32);
- Setpalette(palette);
- read(fh,usamap,32000);
- close(fh);
- }
-
-
- /*********************************************************************
- * scr_copy()
- *
- * This routine copies memory between two screens. We call the
- * raster() function to do the chores.
- **********************************************************************/
-
- scr_copy(scr1,scr2)
- long scr1,scr2;
- {
- raster(scr1,scr2,0,0,320 * offset,200 * offset);
- }
-
-
- /*********************************************************************
- * show_sprites()
- *
- * This routine places the player tokens on the screen. This routine
- * is only called for an entire screen redraw.
- **********************************************************************/
-
- show_sprites()
- {
- int plr_num,sx,sy;
-
- graf_mouse(M_OFF,0L);
- for (plr_num = 0; plr_num < 4; plr_num++) {
- if (on_board[plr_num] == TRUE) {
- if (board_pos[plr_num] == NPROP) {
- sx = 180 * offset + plr_num * 16;
- sy = 170 * offset;
- }
- else {
- sx = (icon_x[board_pos[plr_num]] + 4) * offset;
- sy = (icon_y[board_pos[plr_num]] + 4) * offset;
- }
- switch (plr_num) {
- case 0:
- a_drawsprite(sx,sy,sprites[0],spr1);
- break;
- case 1:
- a_drawsprite(sx,sy,sprites[1],spr2);
- break;
- case 2:
- a_drawsprite(sx,sy,sprites[2],spr3);
- break;
- case 3:
- a_drawsprite(sx,sy,sprites[3],spr4);
- break;
- }
- }
- }
- graf_mouse(M_ON,0L);
- }
-
-
- /*********************************************************************
- * sprite_move()
- *
- * This is responsible for moving a sprite around on the screen. We
- * use the LINE-A sprite draw/undraw routines.
- **********************************************************************/
-
- sprite_move(spr_num,property)
- int spr_num,property;
- {
- int sx,sy;
-
- sx = (icon_x[property] + 4) * offset;
- sy = (icon_y[property] + 4) * offset;
- graf_mouse(M_OFF,0L);
-
- switch (spr_num) {
- case 0:
- a_undrawsprite(spr1);
- break;
- case 1:
- a_undrawsprite(spr2);
- break;
- case 2:
- a_undrawsprite(spr3);
- break;
- case 3:
- a_undrawsprite(spr4);
- break;
- }
- Dosound(crash);
- show_sprites();
- graf_mouse(M_ON,0L);
- }
-
-
- /*********************************************************************
- * roll_dice()
- *
- * This is where we roll the dice. When we enter here the dice
- * automatically begin to roll, the player presses the mouse button
- * to stop them. The function returns an int that is the sum of
- * the two die.
- **********************************************************************/
-
- int roll_dice()
- {
- int die1,die2,j, /* function variables */
- button,mx,my, /* mouse info */
- dx,dy,dw,dh, /* dialog x,y,w,h */
- quit_flag = 0; /* game quit flag */
- OBJECT *tree;
- long old_mousev,dummy;
-
- vex_butv(handle,mouse_rts,&old_mousev);
- do {
- die1 = rnd(6);
- die2 = rnd(6);
-
- graf_mouse(M_OFF,0L);
- if (offset == 2) {
- draw_icon(dice[die1],12,182,128,MONO_DIE_W,MONO_DIE_H);
- draw_icon(dice[die2],12,262,128,MONO_DIE_W,MONO_DIE_H);
- }
- else {
- draw_icon(dice[die1],RASTER_MODE,91,64,C_DIE_W,C_DIE_H);
- draw_icon(dice[die2],RASTER_MODE,131,64,C_DIE_W,C_DIE_H);
- }
- graf_mouse(M_ON,0L);
- wait_jiffy(8);
- vq_mouse(handle,&button,&mx,&my);
- if (button == LEFT) quit_flag = 1;
- if (button == RIGHT) {
- rsrc_gaddr(0,ENDGAME,&tree);
- draw_dialog(tree,&dx,&dy,&dw,&dh,TRUE);
- vex_butv(handle,old_mousev,&dummy);
- j = form_do(tree,0);
- if (j == ENDYES) quit_flag = -1;
- if (j == ENDNO ) quit_flag = 0;
- close_dialog(dx,dy,dw,dh,TRUE);
- vex_butv(handle,mouse_rts,&old_mousev);
- }
- } while (quit_flag == 0);
- vex_butv(handle,old_mousev,&dummy);
- return((die1 + die2 + 2) * quit_flag);
- }
-
-
- /*********************************************************************
- * form_dollar()
- *
- * This routine displays how much money each player has left.
- * This display is in the lower left corner of the screen. If the
- * flag is TRUE the "PLAYER UP" is not drawn. (This is because in
- * low-res the transaction dialog overlaps the "BANK" on screen.
- **********************************************************************/
-
- form_dollar(flag)
- int flag;
- {
- char string[40],num[10]; /* character output string */
- int i,j,k,n;
-
- vst_font(handle,1);
- vst_alignment(handle,0,0,&i,&i);
- if (offset == 2) vst_height(handle,13,&i,&i,&i,&i);
- else vst_height(handle,4,&i,&i,&i,&i);
- vst_color(handle,1);
- vswr_mode(handle,1);
- vst_effects(handle,NORMAL);
-
- if (flag == TRUE) {
- j = 8 - strlen(player_names[player]);
- for (k = 0; k < 40; k++) string[k] = ' ';
- sprintf(&string[j],"%d UP: %s",player + 1,player_names[player]);
- v_gtext(handle, 8 * offset, 8 * offset + 155 * offset, string);
- }
-
- for (i = 0; i < num_players; i++) {
- j = 8 - strlen(player_names[i]);
- sprintf(num,"%dG",cash[i]);
- n = 4 - strlen(num);
- for (k = 0; k <10; k++) num[k] = ' ';
- sprintf(&num[n],"%dG",cash[i]);
- for (k = 0; k < 40; k++) string[k] = ' ';
- if (cash[i] > 0) sprintf(&string[j],"%s: %s",player_names[i],num);
- else sprintf(&string[j],"%s:BROKE",player_names[i]);
- v_gtext(handle, 8 * offset, 8 * offset * i + 171 * offset, string);
- }
- }
-
-
- /*********************************************************************
- * print_prop()
- *
- * This prints out the name of the property that the players token
- * is currently on. The name is printed on the long white box at the
- * bottom of the screen. We first erase the old property name and
- * then print the new name.
- **********************************************************************/
-
- print_prop(pr)
- int pr;
- {
- graf_mouse(M_OFF,0L);
- v_gtext(handle,111 * offset, 195 * offset, spaces);
- v_gtext(handle,111 * offset, 195 * offset, prop_names[pr]);
- graf_mouse(M_ON,0L);
- }
-
-
- /*********************************************************************
- * wait_jiffy()
- *
- * This procedure waits DELAY jiffies. This is used to time certain
- * operations and to sync the graphics with the screen draws.
- **********************************************************************/
-
- wait_jiffy(delay)
- int delay;
- {
- while (delay--) Vsync();
- }
-
-
- /*********************************************************************
- * do_intro()
- *
- * This is the INTRO routine. All we do is copy the USAMAP to the
- * screen and display the INT_DIAL dialog.
- **********************************************************************/
-
- do_intro()
- {
- int choice,dx,dy,dw,dh;
- OBJECT *tree;
-
- scr_copy(usamap,Logbase());
- if (offset == 1) rsrc_gaddr(0,INT_DIAL,&tree);
- else rsrc_gaddr(0,MONO_INT,&tree);
- draw_dialog(tree,&dx,&dy,&dw,&dh,TRUE);
- form_do(tree,0);
- close_dialog(dx,dy,dw,dh,TRUE);
- }
-
-
- /*********************************************************************
- * draw_dialog()
- *
- * This function opens a dialog box on the screen AND saves the
- * underlying graphics so that a fast re-draw may be done.
- * The function needs the following parameters:
- *
- * tree : the resource tree address
- * &dx : the variable that will be the dialogs X coord
- * &dy : the dialog Y coord
- * &dw : the dialog Width
- * &dh : the dialog Height
- * flag : flag for whether a GROW_BOX is drawn
- **********************************************************************/
-
- draw_dialog(tree,x,y,w,h,flag)
- OBJECT *tree;
- int *x,*y,*w,*h,flag;
- {
- int x1,y1;
-
- x1 = *x + *w / 2;
- y1 = *y + *h / 2;
- form_center(tree,x,y,w,h);
- raster(Physbase(),backup,*x,*y,*w+1,*h+2);
- if (flag == TRUE) form_dial(FMD_GROW,x1,y1,10,10,*x,*y,*w,*h);
-
- form_dial(FMD_START,x1,y1,10,10,*x,*y,*w,*h);
- objc_draw(tree,ROOT,MAX_DEPTH,*x,*y,*w,*h);
- }
-
-
- /*********************************************************************
- * close_dialog()
- *
- * This routine is responsible for closing the currently open dialog
- * on the screen. If flag == TRUE a shrinking box is drawn. The
- * routine restores the screen area under the dialog making the
- * redraw of the map much faster and easier.
- **********************************************************************/
-
- close_dialog(x,y,w,h,flag)
- int x,y,w,h,flag;
- {
- int x1,y1;
-
- x1 = x + w / 2;
- y1 = y + h / 2;
-
- form_dial(FMD_FINISH,x1,y1,10,10,x,y,w,h);
- raster(backup,Physbase(),x,y,w+1,h+2);
- if (flag) form_dial(FMD_SHRINK,x1,y1,10,10,x,y,w,h);
- }
-
-
- /*********************************************************************
- * raster()
- *
- * This function will copy a screen raster of ANY size from source
- * to destn. The raster is copied to the same coordinates on both
- * screens.
- *********************************************************************/
-
- raster(source,destn,x,y,w,h)
- long source,destn;
- int x,y,w,h;
- {
- MFDB src,dst;
- int pxy[8],w16;
- char nums[50];
-
- h--;
- w16 = w;
- if (w != ((w / 16) * 16)) w16 = ((w / 16) + 1) * 16;
-
- graf_mouse(M_OFF,0L);
- if (source == Physbase()) src.fd_addr = 0;
- else {
- src.fd_addr = source;
- src.fd_w = w16;
- src.fd_h = h;
- src.fd_wdwidth = w16 / 16;
- src.fd_stand= 0;
- src.fd_nplanes = nplanes;
- }
-
- if (destn == Physbase()) dst.fd_addr = 0;
- else {
- dst.fd_addr = destn;
- dst.fd_w = w16;
- dst.fd_h = h;
- dst.fd_wdwidth = w16 / 16;
- dst.fd_stand= 0;
- dst.fd_nplanes = nplanes;
- }
-
- pxy[0] = x;
- pxy[1] = y;
- pxy[2] = x + w;
- pxy[3] = y + h;
- pxy[4] = x;
- pxy[5] = y;
- pxy[6] = x + w;
- pxy[7] = y + h;
- vro_cpyfm(handle,RASTER_MODE,pxy,&src,&dst);
- graf_mouse(M_ON,0L);
- }
-
-
- /*********************************************************************
- * mouse_rts()
- *
- * This empty routine assembles to an RTS instruction. We point the
- * VDI button handler here so that we do not get mouse button bleed
- * throughs from the AES and VDI.
- **********************************************************************/
- mouse_rts()
- {
- }
-